unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

const N = 800;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Button1: TButton;
    Timer1: TTimer;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;


  Figure = class
    x, y : integer;
    procedure Draw; virtual;abstract;
  end;

  Square = class(Figure)
    a:integer;
    procedure Draw; override;
  end;

  Circle = class(Figure)
    R,c:integer;

    constructor create (c:integer);
    procedure Draw; override;
  end;

  FixedSquare = class(Square)
    constructor create(x,y,a:integer);
    procedure Draw; override;
  end;

  RandomSquare=class(Square)
    constructor create (x,y,a:integer);
    procedure Draw;override;
  end;

var
  Form1: TForm1;
  mas : array [0..N-1] of Figure;

implementation

{$R *.dfm}

{ Square }

procedure Square.Draw;
begin
  Form1.Image1.Canvas.Rectangle(x, y, x+a, y+a);
end;


constructor RandomSquare.create(x,y,a:integer);
begin

end;

procedure RandomSquare.draw;
begin
   Form1.Image1.Canvas.Rectangle(x, y, x+a, y+a);
end;



procedure TForm1.Button1Click(Sender: TObject);
var i : integer;
begin
  for i := 0 to 24 do
  begin

    mas[i].Draw;
  end;
  Timer1.Enabled := True;
end;

procedure TForm1.FormCreate(Sender: TObject);
var i : integer;
begin

  for i := 0 to 49 do
  begin
     if///
      mas[i] := Circle.Create(clblack);
      mas[i] := FixedSquare.Create;

    end;
end;



{ Circle }
constructor FixedSquare.create(x, y, a: integer);
begin
 x,y,R:=random(100)
end;

constructor Circle.create(c1);
begin
x:=100;
y:=100;
c:=c1;
end;

procedure Circle.Draw;
begin

  Form1.Image1.Canvas.Brush.Color := cl;
  Form1.Image1.Canvas.Ellipse(x, y, x+a, y+a);
end;

{ FixedSquare }



procedure FixedSquare.Draw;
begin
  x:=30;
  y:=30;
  a:=30;
  Form1.Image1.Canvas.Rectangle(x, y, x+a, y+a);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var i : integer;
begin
  Image1.Canvas.Rectangle(0, 0, Image1.Width, Image1.Height);
  for i := 0 to N-1 do
  begin
   // mas[i].Move(random(21)-10, random(21)-10);
    mas[i].Draw;
  end;
end;

end.
